home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
Mops 2.7
/
Mops source
/
System source
/
Objinit
< prev
next >
Wrap
Text File
|
1995-07-16
|
3KB
|
100 lines
\ Initialization of system objects.
: -MODELESS \ Sets normal event handling - no modeless dialogs
cfas{ null-evt mouse-evt null-evt key-evt
null-evt key-evt upd-evt disk-evt
actv-evt null-evt null-evt null-evt
null-evt null-evt null-evt OS-evt
null-evt null-evt null-evt null-evt
null-evt null-evt null-evt HL-evt }
put: fEvent ;
' null-evt fill: fevent \ using -modeless during compilation causes
\ strange scrolling effects in fWind
\ APPINIT is the startup word that we execute via ObjInit in installed
\ applications. If fWind is being used it initializes it too. Note
\ that for the Mops development environment we can't set up fWind here,
\ since under System 7 fWind doesn't exist until a dictionary
\ is read in, which is later than ObjInit time. But for an installed
\ application which uses fWind, fWind will be available from the start,
\ so AppInit does the setting up.
: APPINIT { \ top left bot rt -- }
filinit
fWind? IF lock: windowMod
ScreenBits -> bot -> rt -> top -> left
70 70 rt bot true setGrow: fWind
setContRect: fWind
THEN ;
\ SYSINIT is the startup word that initializes the nucleus objects for
\ the Mops development environment above Files.
: SYSINIT
filinit
fWind ['] window set_class lock: windowmod
0 -> actW
['] (key!) -> key!
$ F5EF setMask: fEvent \ mask out key up
-modeless key! +curs
extra_inits ; \ A vector for any extra initialization
\ PAUSE should be called at strategic intervals in all applications,
\ unless Key is being called frequently (see note 1 below). Pause
\ normally calls next: fEvent which allows a task switch to be done
\ under MultiFinder, and which also handles any pending events for this
\ task, such as window updates. Remember to disable any menus etc. that
\ you don't want to execute in this situation! Unexpected re-entrancy
\ is a good way to bomb!
\ NOTE THE FOLLOWING POINTS:
\ 1. KEY also calls next: fEvent. So if we're waiting on keys,
\ we shouldn't call Pause, especially as Pause will gobble any keys
\ typed!
\ 2. next: fEvent calls WaitNextEvent. If we don't want to be
\ suspended until the next event for us, we need to set SleepTicks to
\ a suitably low number. PAUSE by default sets SleepTicks to zero
\ temporarily. Change this if necessary.
\ 3. If multitasking is installed, PAUSE may be redirected (but not
\ necessarily) so that it just calls NEXT_TASK to do a task switch.
\ This will happen if we have a foreground task calling next: fEvent
\ repeatedly, while we do all the real work in the background.
\ This way we can keep executing during window drags and menu selections.
\ 4. Dereferenced pointers may become invalid across a PAUSE. Be careful.
: (PAUSE)
savingDic? ?EXIT \ If called during a dic save, mustn't process
\ events since modules are purged
sleepticks 0 -> sleepticks
getMask: fEvent $ FFC7 setMask: fEvent \ all except key events
next: fEvent \ IF 2drop THEN \ 30Apr94 DBH next: no longer returns stack items
setMask: fEvent -> sleepticks ;
\ CL3 is the next cleanup word - it cleans up all object stuff on abort,
\ as well as whatever we were doing before (see CL2 in file Files, and CL1
\ in file Class).
: CL3
key! word0 call hiliteMenu arrowcurs unmod
cl2 ;
: (SF)
alive: fWind IF setContRect: fWind set: fWind select: fWind THEN
initfont ;
' (pause) -> pause
' sysinit -> objinit
' (sf) -> setFwind
' cl3 -> abortvec